import { get, post, put, del } from '../utils/request';

/**
 * 获取所有路由规则
 * @param {Object} params - 查询参数
 * @returns {Promise}
 */
export const getRoutingRules = (params) => {
  return get('/api/routing-rules', params);
};

/**
 * 获取指定ID的路由规则
 * @param {string} id - 路由规则ID
 * @returns {Promise}
 */
export const getRoutingRuleById = (id) => {
  return get(`/api/routing-rules/${id}`);
};

/**
 * 创建新的路由规则
 * @param {Object} data - 路由规则数据
 * @returns {Promise}
 */
export const createRoutingRule = (data) => {
  return post('/api/routing-rules', data);
};

/**
 * 更新指定ID的路由规则
 * @param {string} id - 路由规则ID
 * @param {Object} data - 路由规则数据
 * @returns {Promise}
 */
export const updateRoutingRule = (id, data) => {
  return put(`/api/routing-rules/${id}`, data);
};

/**
 * 删除指定ID的路由规则
 * @param {string} id - 路由规则ID
 * @returns {Promise}
 */
export const deleteRoutingRule = (id) => {
  return del(`/api/routing-rules/${id}`);
};